package org.baicaix.demo {
	import org.baicaix.pool.ObjectPoolManager;
	import flash.events.TimerEvent;
	import flash.display.Sprite;
	import flash.utils.Timer;

	/**
	 * @author baicaix
	 */
	public class WildFire extends Sprite {
		
		public var vx : Number;
		public var vy : Number;
		public var banjing : Number;
		
		private var life : Timer;

		public function WildFire() {
			vx = 0;
			vy = 0;			
			banjing = 5;
			graphics.beginFill(0xFF0000);
			graphics.drawCircle(0, 0, banjing);
			graphics.endFill();
			
			life = new Timer(3000, 1);
		}

		public function fire() : void {
			life.addEventListener(TimerEvent.TIMER_COMPLETE, die);
			life.start();
		}
		
		private function die(event : TimerEvent) : void {
			life.stop();
			life.removeEventListener(TimerEvent.TIMER_COMPLETE, die);
			ObjectPoolManager.getInstance().recycle(WildFire, this);
		}
	}
}
